//
//  ViewController.m
//  10507
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *leftlabel;
@property (weak, nonatomic) IBOutlet UILabel *rightlabel;
@property (weak, nonatomic) IBOutlet UIButton *left;
@property (weak, nonatomic) IBOutlet UIButton *right;
@property (weak, nonatomic) IBOutlet UIImageView *imageview;
@property (weak, nonatomic) IBOutlet UITextField *say;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)leftpress:(UIButton *)sender
{
    int a=[self.leftlabel.text intValue];
    if(a>=1 || a<=5)
    {
        if(a==1)
        {
           self.leftlabel.text=@"1";
           self.imageview.image=[UIImage imageNamed:@"picture1"];
           self.say.text=@"在他面前其他神马表情都弱爆了";
        }
        else
        {
            a-=1;
            NSString *pictname=[NSString stringWithFormat:@"picture%i",a];
            self.imageview.image=[UIImage imageNamed:pictname];
       
            NSString *newa=[[NSString alloc]initWithFormat:@"%i",a];
            self.leftlabel.text=newa;
            switch (a)
            {
                case 2:
                    self.say.text=@"这也忒狠了";
                    break;
                case 3:
                    self.say.text=@"这个小姑娘吃个牛排比杀牛还费劲";
                    break;
                case 4:
                    self.say.text=@"亲能改下你的网名吗嘻嘻";
                    break;
                case 5:
                    self.say.text=@"哥们为什么选8号呢";
                    break;
                default:
                    break;
            }
        }
    }
}
- (IBAction)rightpress:(UIButton *)sender
{
    int a=[self.leftlabel.text intValue];
    if(a>=1 || a<=5)
    {
        if(a==5)
        {
            self.rightlabel.text=@"5";
            self.imageview.image=[UIImage imageNamed:@"picture5"];
            self.say.text=@"哥们为什么选8号呢";
        }
        else
        {
            a+=1;
            NSString *pictname=[NSString stringWithFormat:@"picture%i",a];
            self.imageview.image=[UIImage imageNamed:pictname];
        
            NSString *newa=[[NSString alloc]initWithFormat:@"%i",a];
            self.leftlabel.text=newa;
    
            switch (a)
            {
                case 1:
                    self.say.text=@"在他面前其他神马表情都弱爆了";
                break;
                case 2:
                    self.say.text=@"这也忒狠了";
                break;
                case 3:
                    self.say.text=@"这个小姑娘吃个牛排比杀牛还费劲";
                break;
                case 4:
                    self.say.text=@"亲能改下你的网名吗嘻嘻";
                break;
                default:
                break;
            }
        }
    }
}

@end
